import numpy as np

# 列表
list_data = [1, 2, 3]
list_result_add = [x + 1 for x in list_data]
list_result_divide = [x / 2 for x in list_data]

# 元组
tuple_data = (1, 2, 3)
tuple_result_add = tuple(x + 1 for x in tuple_data)
tuple_result_divide = tuple(x / 2 for x in tuple_data)

# 集合
set_data = {1, 2, 3}
set_result_add = {x + 1 for x in set_data}  # 集合推导式
set_result_divide = {x / 2 for x in set_data}  # 集合推导式

# ndarray
ndarray_data = np.array([1, 2, 3])
ndarray_result_add = ndarray_data + 1
ndarray_result_divide = ndarray_data / 2

print("List add:", list_result_add)
print("List divide:", list_result_divide)
print("Tuple add:", tuple_result_add)
print("Tuple divide:", tuple_result_divide)
print("Set add:", set_result_add)
print("Set divide:", set_result_divide)
print("ndarray add:", ndarray_result_add)
print("ndarray divide:", ndarray_result_divide)
